package spring_07_transaction.example.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import spring_07_transaction.example.dao.AccountDao;
import spring_07_transaction.example.service.AccountService;

@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
@Service("accountService2")
public class AccountServiceImpl2 implements AccountService{

	@Resource(name="accountDao")
	private AccountDao accountDao;
	
	public void setAccountDao(AccountDao accountDao){
		this.accountDao=accountDao;
	}
	
	@Override
	public void transfer(String outer, String inner, int money) {
        accountDao.out(outer, money);
        //int i = 1/0;
        accountDao.in(inner, money);
    }
	
	

}
